package com.atguigu.spzx.cart.api;

import com.atguigu.spzx.cart.dto.CartItemRedisQueryRespDto;
import com.atguigu.spzx.cart.service.CartService;
import com.atguigu.spzx.cart.vo.CartItemRedisQueryRespVo;
import com.atguigu.spzx.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * CartController
 * </p>
 *
 * @author flyduck
 * @since 2023/11/5
 */
@Api(tags = "购物车接口")
@RestController
@RequestMapping("/api/order/cart")
public class CartApiController {

    @Autowired
    private CartService cartService;

    @ApiOperation("选中的购物车")
    @GetMapping(value = "/auth/getAllCkecked")
    public List<CartItemRedisQueryRespDto> getAllChecked() {
        List<CartItemRedisQueryRespDto> cartInfoList = cartService.getAllChecked() ;
        return cartInfoList;
    }

    @ApiOperation("删除生成订单的购物车商品")
    @GetMapping("/auth/deleteChecked")
    public void deleteChecked(){
        cartService.deleteChecked();
    }

}
